home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
3D Game Programming All in One
/
3D Game Programming All in One Disc.iso
/
3D2E
/
RESOURCES
/
CH2
/
WhilingAway.cs
< prev
next >
Wrap
Text File
|
2006-05-29
|
855b
|
22 lines
// ========================================================================
// WhilingAway.cs
//
// This module is a program that demonstrates while loops. It prints
// random values on the screen as long as a condition is satisfied.
//
// ========================================================================
function runWhilingAway()
// ----------------------------------------------------
// Entry point for the program.
// ----------------------------------------------------
{
%value = 0; // initialize %value
while (%value < 7) // stop looping if %n exceeds 7
{
%value = GetRandom(10); // get a random number between 0 and 10
echo("value="@%value); // print the result
} // back to the top of the loop
// ie. do it all again
}